package main

import (
	"fmt"
	"github.com/gin-gonic/gin"
	"github.com/sirupsen/logrus"
	"hcy-go/global/db"
	"hcy-go/global/structs/enum"
	"hcy-go/lib/config"
	"hcy-go/lib/log"
)

func main() {
	defer logrus.Panic("系统崩溃")
	//初始化日志
	log.InitLog()
	// 初始化数据库
	db.InitDB()
	db.AutoMigrate(enum.AppModules.Lms)
	// 初始化http服务
	app := gin.New()
	r := app.Group("sys")
	RegisterRouter(r)
	err := app.Run(fmt.Sprintf(":%d", config.Conf.ApiPort))
	if err != nil {
		logrus.Error("http服务启动失败：", err)
	}
}
